package com.zhh.dao;

import com.zhh.pojo.TbOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface OrderDao extends JpaRepository<TbOrder,String> {

    @Modifying
    @Query("update TbOrder o set o.status = :state,o.dispenserId = :userId where o.orderId = :orderId")
    int updateOrder(@Param("orderId") String orderId, @Param("state") int state, @Param("userId") Long userId);


    @Query("update TbOrder o set o.status = :state where o.orderId = :orderId")
    @Modifying
    int updateOrderState(@Param("orderId") String orderId, @Param("state") int state);

}
